/*
 * SocketError.h
 *
 *  Created on: 2012-11-30
 *      Author: yangentao@gmail.com
 */

#pragma once;

#include <string>
#include <exception>

using namespace std;
namespace yet{
class SocketError : public exception{
public:
	SocketError();
	SocketError(int errCode);
	SocketError(const SocketError& other);
	virtual ~SocketError();
public:
	static void clearError();
	SocketError& print();
	int getCode();
	string getMessage();
	string getCodeName();

	void throwMe();
	void printThrow();//print and throw
public:
	bool isNetDown();
	bool isNetReset();
	bool isConnReset();
	bool isSocketShutdown();
	bool isHostUnReach();
	bool isAborted();
	bool isTimeout();
	bool isWouldBlock();
private:
	int errorCode;
public:
	string customMessage;
};

}
